export default function(sequelize, DataTypes) {
  return sequelize.define('bill', {
    id: {
      autoIncrement: true,
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    category: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "账单类型"
    },
    remark: {
      type: DataTypes.STRING(500),
      allowNull: true,
      comment: "备注"
    },
    amount: {
      type: DataTypes.DECIMAL(20, 2),
      allowNull: false,
      comment: "金额"
    },
    create_time: {
      type: DataTypes.CHAR(13),
      allowNull: false,
      comment: "创建时间"
    },
    bill_time: {
      type: DataTypes.CHAR(13),
      allowNull: false,
      comment: "订单的发生时间"
    },
    is_delete: {
      type: DataTypes.TINYINT,
      allowNull: false,
      defaultValue: 0,
      comment: "是否逻辑删除 0 没有删除 1 已删除"
    },
    creator_id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      comment: "创建者id"
    },
    is_complete: {
      type: DataTypes.TINYINT,
      allowNull: false,
      defaultValue: 1,
      comment: "是否完成 0未完成 1完成"
    },
    from_id: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "从哪个账单修改过来的"
    },
    company_id: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "公司的id"
    }
  }, {
    sequelize,
    tableName: 'bill',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
